/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package cn.yzc.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>Project: SpringColud - DbController</p>
 * <p>Powered by yzc On 2023-12-27 15:11:00</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */
@RestController
@RefreshScope //注解实现配置的自动跟新
public class DbController {
  @Value("${db.username}")
  String username;

  @Value("${db.password}")
  String password;

  @GetMapping("/config")
  public Map query(){
      Map map = new HashMap<>();
      map.put("username",username);
      map.put("password",password);
      return map;
  }
}
